Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue 818: Add legend to map view #935

Conversation

ncallaway
Copy link

This adds the legend to the map view as described in #818.

Notes

  • The legend is displayed:
    • If the tree view is not displayed, OR
    • If the tree view and map view are displayed "Full" such that they are stacked.
  • The map legend state is stored separately from the tree legend state, so the legend of one view does not impact the other.
  • Toggling any legend state removes the parameter from the URL (whether you toggle the map legend or the tree legend)

PR Questions

  • The thing I'm least happy about is how the <Legend> gets tied to the different redux state
    • The Legend is taking a for parameter, which is expected to be one of tree or map
    • The Legend uses that parameter to decide which legend control state variable to use from redux
    • That variable selection must match the logic in the reducer that sets the two variables.
    • An alternative I considered was having the legend state variable be an object with keys that would match the for parameter, which would reduce the logic coupling, but make the state slightly more complicated.
    • If you have a preference for the alternate implementation, let me know and I can make the change. Or, if you have a better suggestion, I'm happy to make any changes there.
  • I checked the documentation that was added in the PR Issue #900: Load legend state from URL #923 and it seemed generic enough to not require a change with this addition. Let me know if you'd like me to make any changes there.

@jameshadfield jameshadfield temporarily deployed to auspice-issues-issue-81-iw2uob March 13, 2020 05:08 Inactive
@jameshadfield jameshadfield self-requested a review March 13, 2020 23:21
Copy link
Member

@jameshadfield jameshadfield left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @ncallaway, apologies it's taken me a few days to look at this. Overall, really really good. I agree with all the points you made in the Notes section of the PR.

  • Bug - the URL can no longer set the legend to open or closed, it's ignored. I believe this is because the code in modifyStateViaURLQuery() (recomputeReduxState.js) hasn't been updated to reflect the new redux state variable names.

The thing I'm least happy about is how the <Legend> gets tied to the different redux state

Yes I see what you mean here. Keeping a single redux variable would be cleaner, but necessitate that the map & tree legends always act in sync. Having played with this PR I actually like this behavior and it'd result in much cleaner code.

@jameshadfield jameshadfield merged commit a98d0c5 into nextstrain:master Apr 8, 2020
@jameshadfield
Copy link
Member

I've merged this in for release with one extra commit:

971ee32: This removes the "for" parameter, resulting in the open/close state of the legends being in-sync. I consider this a feature not a bug. Additionally, the code is simpler & the URL query for "legend" works again.

Thanks for the work here Noah, this is really nice 👍

@ncallaway
Copy link
Author

👍 Sounds great. Sorry I've gone a little dark on nextstrain work for the last couple of weeks. Work-work has been really busy, but I hope to be back picking up some tasks in the next week or so.

I'm also interested in helping with NextTrace in any way, so if there's anything y'all need help with there, let me know.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants